package com.dhcc.bpm.modules.sandbox.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcc.bpm.common.text.Convert;
import com.dhcc.bpm.modules.sandbox.entity.ApiReturn;
import com.dhcc.bpm.modules.sandbox.mapper.ApiReturnMapper;
import com.dhcc.bpm.modules.sandbox.service.IApiReturnService;
import com.dhcc.bpm.modules.sandbox.vo.ApiReturnCodeVO;
import com.dhcc.bpm.modules.sandbox.vo.ApiReturnVO;
import org.springframework.stereotype.Service;

/**
 * @ClassName ApiReturnServiceImpl
 * @Description 接口返回码关联表 服务实现类
 * @Author sjm
 * @Date 2020/2/21 0021 15:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 **/
@Service
public class ApiReturnServiceImpl extends ServiceImpl<ApiReturnMapper, ApiReturn> implements IApiReturnService {

	/**
	 * 自定义分页
	 * @Author sjm
	 * @Date 18:13 2020/2/21 0021
	 * @param page
	 * @param apiReturn
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.sandbox.vo.ApiReturnVO>
	 **/
	@Override
	public IPage<ApiReturnVO> selectApiReturnPage(IPage<ApiReturnVO> page, ApiReturnVO apiReturn) {
		return page.setRecords(baseMapper.selectApiReturnPage(page, apiReturn));
	}
	/**
	 * 自定义分页
	 * @Author sjm
	 * @Date 18:13 2020/2/21 0021
	 * @param page
	 * @param apiReturnCodeVO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.sandbox.vo.ApiReturnCodeVO>
	 **/
	@Override
	public IPage<ApiReturnCodeVO> selectApiReturnCodePage(IPage page, ApiReturnCodeVO apiReturnCodeVO) {
		return page.setRecords(baseMapper.selectApiReturnCodePage(page, apiReturnCodeVO));
	}

	/**
	 * 根据实例ID查询返回码
	 * @Author sjm
	 * @Date 18:13 2020/2/21 0021
	 * @param page
	 * @param apiReturnCodeVO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.sandbox.vo.ApiReturnCodeVO>
	 **/
	@Override
	public IPage<ApiReturnCodeVO> selectApiReturnCodeByCaseId(IPage page, ApiReturnCodeVO apiReturnCodeVO) {
		return page.setRecords(baseMapper.selectApiReturnCodeByCaseId(page, apiReturnCodeVO));
	}

	/**
	 * 查询返回码
	 * @Author sjm
	 * @Date 18:13 2020/2/21 0021
	 * @param apiId
	 * @return com.dhcc.bpm.modules.sandbox.entity.ApiReturn
	 **/
	@Override
	public ApiReturn selectApiReturn(long apiId) {
		return baseMapper.selectApiReturn(apiId);
	}

	/**
	 * 删除返回码
	 * @Author sjm
	 * @Date 18:14 2020/2/21 0021
	 * @param apiId
	 * @param ids
	 * @return java.lang.Boolean
	 **/
	@Override
	public Boolean deleteReturnCode(Long apiId, String ids) {
		return baseMapper.deleteReturnCode(apiId,Convert.toLongArray(ids));
	}
}
